It sounds like Nunjucks is getting stuck because of how the tags variable is being handled. In Eleventy, tags can sometimes be a single string or undefined, which can cause the entire page to fail to render if the loop or the if statement crashes.
The Fix: Use a more robust check
We can use the all collection or a more defensive if check to ensure the page doesn't go blank. Replace that section of your layout.njk with this version:
HTML
{{ title }}
{# Check if 'post' is in the tags array safely #}
{% if tags and "post" in tags %}
{# Tags - using a filter to ensure it's iterable #}
{% for tag in tags %}
{% if tag != "post" %}
{{ tag }}
{% endif %}
{% endfor %}
{# Read Time #}
• {{ content | readTime }}
{# Ensure content is always rendered #}
---
Why the content might have disappeared
- Nunjucks Error: If tags is missing from a file's front matter, the expression "post" in tags can sometimes throw an error that stops the rest of the page from rendering.
- The tags variable: In some versions of 11ty, if you only have one tag, it might treat it as a string instead of an array. The loop above is safer.
- Missing safe filter: If the metadata block had a syntax error, Nunjucks might stop exactly at that line, leaving the {{ content | safe }} unexecuted.
How to test if it's working
If the content still fails to show, check your terminal/console for an error message like:
Template render error: (unknown path) [Line X, Column Y].
---
Quick Check for your CSS
Since you moved your styles to public/style.css, make sure you have the Passthrough Copy in your .eleventy.js as we discussed:
JavaScript
// .eleventy.js
eleventyConfig.addPassthroughCopy("public");
If you refresh the page and the content is still missing, could you paste the terminal error you see during the build?